//
//  JinXCCell.m
//  KuWoCan
//
//  Created by hwd on 17/3/6.
//  Copyright © 2017年 hwd. All rights reserved.
//

#import "JinXCCell.h"
#import "btnImageV.h"

@interface JinXCCell ()

@property (nonatomic,strong) UILabel *numberLab;

@property (nonatomic,strong) UILabel *numberSYLab;

@property (nonatomic,strong) UILabel *timeLab;

@property (nonatomic,strong) UILabel *bigLab;

@end

@implementation JinXCCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = 0;
        _bigLab = [[UILabel alloc]initWithFrame:CGRectMake(15*screenW_6, 20*screenW_6, 35*screenW_6, 35*screenW_6)];

        [self.contentView addSubview:_bigLab];
        _bigLab.font = [UIFont systemFontOfSize:22*screenW_6];
        _bigLab.textColor = [UIColor whiteColor];
        _bigLab.textAlignment = NSTextAlignmentCenter;
        [_bigLab.layer setCornerRadius:17.5*screenW_6];
        _bigLab.layer.masksToBounds = YES;
        [self.contentView addSubview:_bigLab];

        _numberLab = [TomamaUI createLabel:CGRectMake(CGRectGetMaxX(_bigLab.frame)+10*screenW_6, 12.5*screenW_6, 120*screenW_6, 25*screenW_6) textAligment:0 font:[UIFont systemFontOfSize:15*screenW_6] textColor:[UIColor colorWithHexString:@"#55aee9"] text:[NSString stringWithFormat:@"＋%@",@"1000"]];
        [self.contentView addSubview:_numberLab];

        UILabel *shenYuLab = [TomamaUI createLabel:CGRectMake(CGRectGetMaxX(_bigLab.frame)+10*screenW_6,CGRectGetMaxY(_numberLab.frame), 75*screenW_6, 25*screenW_6) textAligment:0 font:[UIFont systemFontOfSize:14*screenW_6] textColor:[UIColor colorWithHexString:@"#999999"] text:@"剩余库存："];
        [self.contentView addSubview:shenYuLab];

        _numberSYLab = [TomamaUI createLabel:CGRectMake(CGRectGetMaxX(shenYuLab.frame),CGRectGetMaxY(_numberLab.frame),120*screenW_6, 25*screenW_6) textAligment:0 font:[UIFont systemFontOfSize:13*screenW_6] textColor:[UIColor colorWithHexString:@"ff6000"] text:@"1500"];
        [self.contentView addSubview:_numberSYLab];

        UIImageView *nextImage = [TomamaUI createImageView:CGRectMake(SCREENW-40*screenW_6, 12.5*screenW_6, 25*screenW_6, 25*screenW_6) backGroundImageV:@"next"];
        [self.contentView addSubview:nextImage];

        _timeLab = [TomamaUI createLabel:CGRectMake(SCREENW-200*screenW_6 ,CGRectGetMinY(_numberLab.frame),150*screenW_6,25*screenW_6) textAligment:2 font:[UIFont systemFontOfSize:14*screenW_6] textColor:[UIColor colorWithHexString:@"999999"] text:@"3月30号"];
        [self.contentView addSubview:_timeLab];
    }
    return self;
    
}

- (void)setModel:(ESSListModel *)model
{
    _timeLab.text = model.createDate;
    
    _numberSYLab.text = model.surplusBox;
    
    if ([model.invoicingType isEqualToString:@"1"])
    {
        _bigLab.text = @"进";
        _bigLab.backgroundColor = [UIColor colorWithHexString:@"55aee7"];
        _numberLab.textColor = [UIColor colorWithHexString:@"55aee7"];
        _numberLab.text = [NSString stringWithFormat:@"+%@",model.totalBox];
        
    }else
    {
        _bigLab.text = @"售";
        _bigLab.backgroundColor = [UIColor colorWithHexString:@"fe8b8b"];
        _numberLab.textColor = [UIColor colorWithHexString:@"fe8b8b"];
        _numberLab.text = [NSString stringWithFormat:@"-%@",model.totalBox];
    }
    
}



@end
